﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WeiTap.Data.Utilities
{
    /// <summary>
    /// 定义翻页的帮助类接口
    /// </summary>
    public interface IPagingHelper
    {
        /// <summary>
        /// 对SQL语句进行拆分
        /// </summary>
        /// <param name="sql">原始SQL</param>
        /// <param name="parts">拆分后的结果</param>
        /// <returns></returns>
        bool SplitSQL(string sql, out SQLParts parts);
    }
    /// <summary>
    /// 对SQL拆分的部分定义
    /// </summary>
    public struct SQLParts
    {
        /// <summary>
        /// 原始SQL
        /// </summary>
        public string Sql;
        /// <summary>
        /// 获取数量的SQL
        /// </summary>
        public string SqlCount;
        /// <summary>
        /// 移除Select部分后的SQL
        /// </summary>
        public string SqlSelectRemoved;
        /// <summary>
        /// 排序部分的SQL
        /// </summary>
        public string SqlOrderBy;
    }
}